--
-- Created by IntelliJ IDEA.
-- User: train
-- Date: 2018/7/26
-- Time: 上午11:27
-- To change this template use File | Settings | File Templates.
--

package.path = '/workspace/project/go/src/linker/script/lib/?.lua;'
local json = require('json')
local mysql = require("mysql")
function run(param)
    --local p=json.decode(param)
    --local number=p.number
    --sqltable = {}
    --sqltable[1]=number[1]
    --row=m.query("select * from approval where approval_number=? limit 20",json.encode(sqltable))
    --json.encode(row)
    --return row
    local param={
        {key='query',sql='select * from test1 limit 1',param=json.encode({}) },
        {key='query',sql='select * from test1 limit 1',param=json.encode({}) },
        {key='update',sql='insert into test2(id,nick) values(?,?)',param=json.encode({'#{r0[0].id}','train'}) },
        {key='update',sql='insert into test3(id,num) values(?,?)',param=json.encode({'#{r1[0].id}','20'}) }
    }
    local ret=mysql.tx(param)
    local data={key=ret}
    return json.encode(data)
end
